package com.lishao.soccer.action;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.lishao.soccer.service.ProcedureService;
import com.lishao.system.security.providers.SecurityUser;
import com.lishao.system.utils.ActionUtil;
import com.opensymphony.xwork2.ActionSupport;

public class ProcedureAction extends ActionSupport {
	Long teamId;
	Long tmGameId;
	ProcedureService procedureService;
	
	public String sumGameData() throws Exception{
		HttpServletRequest request = ServletActionContext.getRequest();

		HttpSession session = request.getSession();
		SecurityUser secUser = (SecurityUser)session.getAttribute("LOGIN_KEY");
		Map paraMap = new HashMap();
		paraMap.put("tmGameId", tmGameId);
		paraMap.put("userId", secUser.getSmUser().getRowId());
		procedureService.sumGameData(paraMap);
		
		new ActionUtil().writeMap(paraMap);
		return null;
	}
	public String closeTeamGame() throws Exception{
		HttpServletRequest request = ServletActionContext.getRequest();

		HttpSession session = request.getSession();
		SecurityUser secUser = (SecurityUser)session.getAttribute("LOGIN_KEY");
		Map paraMap = new HashMap();
		paraMap.put("tmGameId", tmGameId);
		paraMap.put("userId", secUser.getSmUser().getRowId());
		procedureService.closeTeamGame(paraMap);
		
		new ActionUtil().writeMap(paraMap);
		return null;
	}
	//get set
	public ProcedureService getProcedureService() {
		return procedureService;
	}

	public void setProcedureService(ProcedureService procedureService) {
		this.procedureService = procedureService;
	}

	public Long getTeamId() {
		return teamId;
	}
	public void setTeamId(Long teamId) {
		this.teamId = teamId;
	}
	public Long getTmGameId() {
		return tmGameId;
	}

	public void setTmGameId(Long tmGameId) {
		this.tmGameId = tmGameId;
	}
}
